package com.itheima.sh;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author 张伟奇
 * @Date 2021/5/17 16:54
 * @Version 1.0
 **/
@WebServlet("/myServlet01")
public class MyServlet01 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

//        resp.setStatus(302);
//        resp.setHeader("location","https://www.baidu.com");

        resp.sendRedirect("https://www.baidu.com");
    }
}
